//
//  XCCollectionSonglistTableViewCell.m
//  SoundOfNature
//
//  Created by 梁新昌 on 16/3/13.
//  Copyright © 2016年 梁新昌. All rights reserved.
//

#import "XCCollectionSonglistTableViewCell.h"

@implementation XCCollectionSonglistTableViewCell

- (void)dealloc
{
    [_collectionNameLable release];
    [_collectionImageView release];
    [_detailButton release];
    [_numberLable release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.collectionImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
//        self.collectionImageView.backgroundColor = [UIColor colorWithRed:0.400 green:1.000 blue:1.000 alpha:1.000];
        self.collectionImageView.image = [[UIImage imageNamed:@"Image-mytableSongList"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        
        self.collectionNameLable = [[XCBaseLable alloc] initWithFrame:CGRectZero];
        self.numberLable = [[UILabel alloc] initWithFrame:CGRectZero];
        self.detailButton = [UIButton buttonWithType:UIButtonTypeSystem];
        
        [self.contentView addSubview:self.collectionNameLable];
        [self.contentView addSubview:self.collectionImageView];
        [self.contentView addSubview:self.numberLable];
        [self.contentView addSubview:self.detailButton];
        
        [self.collectionImageView release];
        [self.collectionNameLable release];
        [self.numberLable release];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.collectionImageView.frame = CGRectMake(10, 5, self.bounds.size.width / 8, self.bounds.size.width / 8);
    self.collectionNameLable.frame = CGRectMake(30 + self.collectionImageView.frame.size.width, (self.bounds.size.height - 47) / 5, self.bounds.size.width / 4, 21);
    self.numberLable.frame = CGRectMake(30 + self.collectionImageView.frame.size.width, 5 + self.collectionNameLable.frame.size.height + self.collectionNameLable.frame.origin.y, self.bounds.size.width / 5, 21);
    self.numberLable.font = [UIFont systemFontOfSize:10];
    self.numberLable.textColor = [UIColor colorWithWhite:0.902 alpha:1.000];
    
    self.detailButton.frame = CGRectMake(self.bounds.size.width - 50, self.bounds.size.height / 2 - 15, 30, 30);
    [self.detailButton setImage:[[UIImage imageNamed:@"Image-more"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateHighlighted];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
